package com.argticling.service;

import com.argticling.dao.interf.PreferenceDAO;
import com.argticling.dao.interf.UserPreferenceRelationDAO;
import com.argticling.model.User;
import com.argticling.model.preferences.ArticlePreference;
import com.argticling.model.preferences.UserPreferenceRelation;

import java.util.List;
import java.util.UUID;

public class PreferenceService {
    private PreferenceDAO preferenceDao;
    private UserPreferenceRelationDAO userPreferenceRelationDAO;
    private String userPreferenceRelationDao;

    public List<ArticlePreference> getPreferences(String preferenceId) {
        //todo completar
        return null;
    }

    public List<ArticlePreference> getUsersPreferences(String articlePreferenceId, String userId) {
        //todo completar
        return null;
    }

    public void putUserPreference(String preferenceId, String userId, String articleId) {
        UserPreferenceRelation userPreferenceRelation = new UserPreferenceRelation();
        userPreferenceRelation.setArticleId(articleId);
        //el UUID es del estilo 0c7d43d0-bcb9-44f9-808b-61593001e435
        //tiene 36 caracteres: 32 + 4 guiones
        userPreferenceRelation.setId(UUID.randomUUID().toString());
        userPreferenceRelation.setUserId(userId);
        userPreferenceRelationDAO.persist(userPreferenceRelation);
    }

    public PreferenceDAO getPreferenceDao() {
        return preferenceDao;
    }

    public void setPreferenceDao(PreferenceDAO preferenceDao) {
        this.preferenceDao = preferenceDao;
    }

    public UserPreferenceRelationDAO getUserPreferenceRelationDAO() {
        return userPreferenceRelationDAO;
    }

    public void setUserPreferenceRelationDAO(UserPreferenceRelationDAO userPreferenceRelationDAO) {
        this.userPreferenceRelationDAO = userPreferenceRelationDAO;
    }

    public void setUserPreferenceRelationDao(String userPreferenceRelationDao) {
        this.userPreferenceRelationDao = userPreferenceRelationDao;
    }

    public String getUserPreferenceRelationDao() {
        return userPreferenceRelationDao;
    }

	public void getArticlePreferences(String articleId) {
		// TODO Auto-generated method stub
		
	}
}
